package io.litchi.auth.domain.factory;

import io.litchi.auth.Infrastructure.common.command.menupern.MenuPernSaveCommand;
import io.litchi.auth.Infrastructure.common.result.menu.TreeMenuResult;
import io.litchi.auth.domain.entity.auth.MenuPerm;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

import static org.mapstruct.MappingConstants.ComponentModel.SPRING;
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
import static org.mapstruct.NullValuePropertyMappingStrategy.IGNORE;

@Mapper(nullValuePropertyMappingStrategy = IGNORE, nullValueCheckStrategy = ALWAYS,
        unmappedSourcePolicy = ReportingPolicy.IGNORE, unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = SPRING)
public interface MenuPermFactory {
    MenuPermFactory INSTANCE = Mappers.getMapper(MenuPermFactory.class);

    TreeMenuResult mapToEntity(MenuPerm menuPerm);

    List<TreeMenuResult> mapToTreeMenuList(List<MenuPerm> menuPermList);

    MenuPerm mapToEntity(MenuPernSaveCommand menuPernSaveCommand);

    MenuPernSaveCommand mapToCommand(MenuPerm menuPerm);
}
